#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
int main(int argc, char const *argv[])
{
        int n = 5;
        int i;
        for (i = 0; i < n; i++){
                pid_t pid = fork();
                if(pid == 0){
                        break;
                }
        }
        if(i == 2){
                printf("I will kill father after 5s\n");
                sleep(5);
                kill(getppid(), SIGKILL);
                while (1){
                        sleep(1);
                }
        }else if(i == n){
                //parent
                while (1) {
                        printf("I am parent,I am happy!\n");
                        sleep(1);
                }
        }
        return 0;
}
